/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * busquedaEmpleado.java
 *
 * Created on 24-nov-2010, 19:14:00
 */
//
package GUI.clinica;
import javax.swing.JOptionPane;
/*
 *
 * @author RafaelGutierrez
// */
public class busquedaEmpleado extends javax.swing.JFrame {

    /** Creates new form busquedaEmpleado */

    public busquedaEmpleado() {
        initComponents();
    }

    /* This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.*/
     
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        TxtCedula = new javax.swing.JTextField();
        LabelCedulaEmpleado = new javax.swing.JLabel();
        BotonBuscar = new javax.swing.JButton();
        BotonRegresar = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setForeground(new java.awt.Color(255, 0, 0));
        jLabel1.setText("Busqueda de Empleado");

        TxtCedula.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TxtCedulaActionPerformed(evt);
            }
        });

        LabelCedulaEmpleado.setFont(new java.awt.Font("Tahoma", 0, 12));
        LabelCedulaEmpleado.setText("Cedula de Empleado:");

        BotonBuscar.setText("Buscar");
        BotonBuscar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonBuscarActionPerformed(evt);
            }
        });

        BotonRegresar.setText("Regresar ");
        BotonRegresar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonRegresarActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .addContainerGap()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(LabelCedulaEmpleado)
                            .add(BotonBuscar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 79, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .add(10, 10, 10)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                            .add(TxtCedula, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 124, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                            .add(BotonRegresar)))
                    .add(layout.createSequentialGroup()
                        .add(23, 23, 23)
                        .add(jLabel1)))
                .add(255, 255, 255))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(20, 20, 20)
                .add(jLabel1)
                .add(36, 36, 36)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(LabelCedulaEmpleado, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 17, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(TxtCedula, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(26, 26, 26)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(BotonBuscar, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 23, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(BotonRegresar))
                .addContainerGap(37, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void TxtCedulaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TxtCedulaActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_TxtCedulaActionPerformed

    private void BotonBuscarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonBuscarActionPerformed
      // if (TxtCedula.getText().isEmpty()){ /*&& (!TxtNombre.getText().isEmpty()) && (!TxtApellido.getText().isEmpty()) && (!TxtAnioNac.getText().isEmpty()) && (!TxtLocalidad.getText().isEmpty()) && (!TxtNumeroColegiatura.getText().isEmpty()) && (!TxtUniversidadEgreso.getText().isEmpty()) && (!TxtEstudiosEspeciales.getText().isEmpty()) && (!TxtEspecialidad.getText().isEmpty()) && (!TxtDisponibilidad.getText().isEmpty()) && (!TxtHoraEntrada.getText().isEmpty()) && (!TxtHoraSalida.getText().isEmpty())*/
        /*    JOptionPane.showMessageDialog(null, "Error, campo invalidos", "Debe indicar un numero de cedula valido", JOptionPane.ERROR_MESSAGE);
        } else {
            int valor = Validar.ValidarEntero(TxtCedula.getText(), "Cédula no es numérica");
            if (valor == 1) {
               Doctor doct = datosDoct.buscarDoctor(Integer.parseInt(TxtCedula.getText()));
                if (doct == null) {
                  JOptionPane.showMessageDialog(null, "Doctor no Existe", "Error cédula no encontrada", JOptionPane.ERROR_MESSAGE);
                } else {

                    informacionDoctor ventana =  new informacionDoctor(doct);
                    ventana.setVisible(true);
                    this.dispose();
                    TxtNombre.setText(doct.getNombre());
                    TxtApellido.setText(doct.getApellido());
                    TxtCedula.setText(String.valueOf(doct.getCedula()));
                    TxtAnioNac.setText(doct.getAnionac());
                    ComboBoxLocalidad.setVisible(false);
                    LabelLocalidad.setVisible(false);
                    TxtNumeroColegiatura.setText(doct.getNumerocolegitura());
                    TxtUniversidadEgreso.setText(doct.getUniversidadegreso());
                    TxtEstudiosEspeciales.setText(doct.getEstudioespeciales());
                    TxtEspecialidad.setText(doct.getEspecialidad());
                    TxtAniosExperiencia.setText(String.valueOf(doct.getAnioexperiencia()));
                    ComboBoxDisponible.setVisible(false);
                    LabelDisponible.setVisible(false);
                    TxtHoraEntrada.setText(doct.getHoraentrada());
                    TxtHoraSalida.setText(doct.getHorasalida());
                    TxtTelefono.setText(doct.getTelefono());
                    TxtDireccion.setText(doct.getDireccion());
                    int conf= JOptionPane.showOptionDialog(
                            null, "¿Desea Realizar La Operación?", "::::...Confirmación...:::",
                            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null);
                    if (conf == 0) {
                        datosDoct.borrarDoctor(Integer.parseInt(TxtCedula.getText()));
                        clearScreen();
                        TxtCedula.setText("");
                        TxtCedula.setText("");
                    }
                }
        }
            informacionEmpleado ventana =  new informacionEmpleado();
        ventana.setVisible(true);
        this.dispose();
*/
}//GEN-LAST:event_BotonBuscarActionPerformed


    
    private void BotonRegresarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonRegresarActionPerformed
        clinica ventana =  new clinica();
        ventana.setVisible(true);
        this.dispose();
}//GEN-LAST:event_BotonRegresarActionPerformed

    
    
    // @param args the command line arguments
    
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new busquedaEmpleado().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonBuscar;
    private javax.swing.JButton BotonRegresar;
    private javax.swing.JLabel LabelCedulaEmpleado;
    private javax.swing.JTextField TxtCedula;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables

}

